<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <include file="Public:jquery" />
        <include file="Public:dialog" />
        <script type="text/javascript" src="__PUBLIC__/js/jQuery/plugin/jquery.filestyle.js"></script>
        <include file="Public:ajaxupload" />
        <include file="Public:startapp" />
        <include file="Public:startmoo" />
        <script type="text/javascript">
            $(function(){
                inputFileStyle();
            });
            function getCode(e){
				art.dialog({
					title : '获取代码',
					lock : true,
					content : '<textarea style="width:450px; height:140px;">&lt;script src=&quot;/adfree/getAD?item='+e+'&quot;&gt;&lt;/script&gt;</textarea>'
				});
			}
			// input file 模拟
            function inputFileStyle(){
                $("input[type=file]").filestyle({
                    image : "../Public/images/chk.png",
                    imageheight : 25,
                    imagewidth : 86,
                    width : 260
                });
            }
            
        </script>
    </head>
    <body>
        <include file="Public:header" />
        
        <div class="layout">
            
            <include file="Public:position" />
            
            <table class="warp" cellpadding="0" cellspacing="0">
                <tr>
                    <td class="sidebar" valign="top">
                        <include file="Public:sidebar" />
                    </td>
                    <td class="contents" valign="top">
                        
                        <?php
						   if (!isset($_GET['type'])){
						       $type = 'index';
						   }else{
						       $type = $_GET['type'];
						   }
						?>
						
						<ul class="act_this">
				    		<li<?php if(!isset($_GET['type'])){ ?> class="this"<?php } ?>><a href="{:U('index',array('tag'=>$_GET['tag']))}">首页轮换广告</a></li>
				    		<li<?php if($_GET['type'] == 'about'){ ?> class="this"<?php } ?>><a href="{:U('index',array('tag'=>$_GET['tag'],'type'=>'about'))}">关于我们(首页)</a></li>
				    		<li<?php if($_GET['type'] == 'allfree'){ ?> class="this"<?php } ?>><a href="{:U('index',array('tag'=>$_GET['tag'],'type'=>'allfree'))}">自由定制广告</a></li>
				    	</ul>
				    	
				    	
				    	    <?php
				    	        if ($type != 'about'){
				    	    ?>
				    	    <div class="button" style="margin-top: 10px;">
	                        	<a href="{:U('add?tag='.$_GET['tag'].'&type='.$type)}" class="default_button" id="add_index_banner"><span></span>新增</a>
	                        </div>
				    	    <?php
				    	        }
				    	    ?>
	                    
                                              
                        <div class="a_table">
				    	<?php
				    	    if ($type == 'about'){
				    	?>
				    	<form action="__URL__/aboutsave" method="post">
				    	<input type="hidden" name="tag" value="{$_GET['tag']}" />
				    	<input type="hidden" name="status" value="1" />
	                    <table cellspacing="1" width="100%" class="gr_list">
	                        <tr>
	                            <td align="right">标题</td>
	                            <td><input type="text" name="title" class="input_text" value="{$about.title}" /></td>
	                        </tr>
	                        <tr>
	                            <td align="right">链接地址</td>
	                            <td><input type="text" name="url" class="input_text" value="{$about.url}" /></td>
	                        </tr>
	                        <tr id="old_banner">
	                            <td align="right">图片</td>
	                            <td><img src="{$about.banner}" /></td>
	                        </tr>
	                        <tr id="set_banner">
	                            <td align="right">上传图片</td>
	                            <td>
	                                <span class="file_d_Upload">
	                                    <input id="filedata" type="file" class="attText" name="filedata">
	                                    <button class="attButton" id="buttonUpload" onclick="return ajaxFileUpload();">重新上传</button>
	                                </span>
	                            </td>
	                        </tr>
	                        <tr style="display:none;" id="loading">
	                            <td></td>
	                            <td align='left'><img src="../Public/images/loading.gif" /></td>
	                        </tr>
	                        <tr>
	                            <td align="right">内容</td>
	                            <td><textarea name="dsp" id="content" style="width: 70%; height:260px;">{$about.dsp}</textarea></td>
	                        </tr>
	                        <tr>
	                            <td></td>
	                            <td><input type="submit" value="提交" /></td>
	                        </tr>
	                    </table>
	                    </form>
				    	<?php
				    	    }else{
				    	?>
				    	<table cellspacing="1" width="100%" class="gr_list">
	                        <tr style="background: #f0f7ff; font-weight: bold;">
	                            <td width="20" height="20" class="left_text"></td>
	                            <td width="60" align="center" class="left_text">编号</td>
	                            <td align="center" class="left_text">标题名称</td>
	                            <td align="center" class="left_text">链接</td>
	                            <td width="100" align="center" class="left_text">状态</td>
	                            <td width="200" align="center" class="left_text">操作</td>
	                        </tr>
	                        <volist id="vo" name="list">
	                        <tr rel="{$vo['id']}">
	                            <td><input type="checkbox" name="list[]" value="{$vo.id}" /></td>
	                            <td align="center">{$vo['id']}</td>
	                            <td><a href="{:U('edit',array(
	                                'id' => $vo['id'],
	                                'tag' => $_GET['tag'],
	                            ))}">{$vo['title']}</a></td>
	                            <td align="center">{$vo['url']}</td>
	                            <td align="center">{$vo['status']|getStatus}</td>
	                            <td align="center">
	                                <?php if($_GET['type'] == 'allfree'){ ?><a href="javascript:getCode('{$vo.id}');">获取代码</a>&nbsp;&nbsp;|&nbsp;&nbsp;<?php } ?>{$vo['status']|showStatus=$vo['id']}<span class="action_line">&nbsp;&nbsp;|&nbsp;&nbsp;</span><a href="{:U('edit',array(
	                                'id' => $vo['id'],
	                                'tag' => $_GET['tag'],
	                            ))}" class="edit_model">编辑</a><span class="action_line">&nbsp;&nbsp;|&nbsp;&nbsp;</span><a href="{:U('delete',array(
	                                'id' => $vo['id'],
	                            ))}" class="del_node" rel="{$vo.id}">删除</a>
	                            </td>
	                        </tr>
	                        </volist>
	                    </table>
	                    <div class="page">{$page}</div>
				    	<?php
				    	    }
				    	?>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
        
        <include file="Public:footer" />
    </body>
</html>